fix: crash on startup — TwoWay binding on read-only EndurancePercent - #1
Merged
SysAdminDoc merged 1 commit intoAug 25, 2026
Conversation
ProgressBar.Value inherits from RangeBase.ValueProperty which has BindsTwoWayByDefault=true, causing a TwoWay binding on the read-only EndurancePercent property. This throws InvalidOperationException at startup, crashing the app before the window renders. Fixes crash: A TwoWay or OneWayToSource binding cannot work on the read-only property 'EndurancePercent'
SysAdminDoc
added a commit
that referenced
this pull request
Aug 25, 2026
…erties Scans every view XAML for bindings on dependency properties whose WPF metadata sets BindsTwoWayByDefault and resolves the binding path against the conventional view model via reflection. A read-only target without an explicit Mode=OneWay fails the test, which is the exact condition that crashed startup via EndurancePercent (PR #1).
Owner
|
Good catch, and thanks for the clear writeup. Your diagnosis was exactly right: RangeBase.Value binds two way by default and EndurancePercent has no setter. The line had drifted on main since July (the automation name got localized), so I merged your branch locally, kept your commit, and resolved the conflict there. It shipped in v0.9.22 along with a new test that scans every view for default two way bindings aimed at read only viewmodel properties, so this whole class of crash now fails the suite instead of the app. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
The app crashes immediately on startup with:
Root Cause
ProgressBar.Valueinherits fromRangeBase.ValueProperty, which is registered withBindsTwoWayByDefault=true. The binding{Binding EndurancePercent}inDiskHealthView.xamlis therefore silently promoted to a TwoWay binding. SinceEndurancePercentis a computed getter-only property (no setter), WPF throws during window initialization and kills the process.Fix
Added
Mode=OneWayto the binding — one attribute. The ProgressBar displays the computed value; it doesn't need to write back.Verification